<!DOCTYPE html>
<html
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        >

<h:head>
    <title>Previous Results</title>
    <h:outputStylesheet library="css" name="typeface.css"/>
    <h:outputStylesheet library="css" name="common.css"/>
    <h:outputStylesheet library="css" name="bootstrap.css"/>
    <h:outputStylesheet library="css" name="login.css"/>
    <f:loadBundle basename="com.dataart.training.crimequalification.facesutils.messages"
                  var="msgs"></f:loadBundle>
    <f:loadBundle basename="com.dataart.training.crimequalification.facesutils.configurations"
                  var="conf"></f:loadBundle>
</h:head>

<f:view>

    <h:body styleClass="body">
        <ui:include src="/views/navbar.xhtml"/>

        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span2">
                    <ui:include src="sidebar.xhtml"/>
                </div>
                <div class="span7">
                    <!-- Main unit -->

                    <h:panelGroup id="mainobject">
                        <p style="font-size: 30px" class="text-info">Предыдущие результаты</p>
                        <hr/>
                        <br/>

                        <div class="span8">
                            <table class="table table-striped table-hover">
                                <thead>
                                <tr>
                                    <th>Номер задания</th>
                                    <th>Дата решения</th>
                                    <th>Результат</th>
                                    <th style="width: 36px;"></th>
                                </tr>
                                </thead>

                                <tbody>
                                <ui:repeat var="t" value="#{previousResultsBean.tasks}">

                                    <h:panelGroup rendered="#{not previousResultsBean.solutionPassed(t)}">
                                        <tr class="error">
                                            <td>${t.task.taskId}</td>
                                            <td>#{previousResultsBean.formatDate(t.submissionDate)}</td>
                                            <td>${t.percentage}%</td>
                                        </tr>
                                    </h:panelGroup>

                                    <h:panelGroup rendered="#{previousResultsBean.solutionPassed(t)}">
                                        <tr class="success">
                                            <td>${t.task.taskId}</td>
                                            <td>#{previousResultsBean.formatDate(t.submissionDate)}</td>
                                            <td>${t.percentage}%</td>
                                        </tr>
                                    </h:panelGroup>

                                </ui:repeat>
                                </tbody>
                            </table>
                        </div>
                    </h:panelGroup>
                    <br/>
                    <br/>
                </div>
            </div>


        </div>

    </h:body>

</f:view>
</html>